#pragma once

#include <vector>
#include <string>
#include <map>
#include "Base/EntityManager.h"
#include "Base/Entity.h"

class GameState;
typedef std::map<int, std::map<std::string, std::string> > PropertyMap;

struct TileSet
{
	TileSet()
	{

	}
	TileSet(int first, std::map<int,std::string> arg) : firstElem(first), tiles(arg)
	{

	}

	int firstElem;
	std::map<int,std::string> tiles;
	PropertyMap properties;
};

std::string getModelFile(std::vector<TileSet>& tilesets, int id, TileSet* result = NULL);


class MapLoader
{
public:
	MapLoader();
	MapLoader(const std::string& filename,  BPL::EntityManager* parent, GameState* state);
	~MapLoader();

	bool load(const std::string& filename, BPL::EntityManager* parent, GameState* state);
	//void saveFile(const std::string& filename, BPL::EntityManager* parent);
};

class TilesetLoader
{
public:
	TilesetLoader();
	TilesetLoader(const std::string& filename);
	~TilesetLoader();

	const std::map<int,std::string>& getTileset() const;
	std::map<int,std::string> load(const std::string& filename);

protected:
	std::map<int,std::string> mpt_tileset;
};
